package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

/**
 * ClassName: OrderMapper
 * Package: com.sky.mapper
 * Description:
 *
 * @Author 龙培
 * @Create 2025/3/15 14:28
 * @Version 1.0
 */
@Mapper
public interface OrderMapper {

    void insert(Orders orders);

    Page<Orders> pageQuery(OrdersPageQueryDTO ordersPageQueryDTO);

    @Select("select * from orders where id = #{orderId}")
    Orders getByOrderId(Long orderId);


    void update(Orders orders);

    @Select("select * from orders where number = #{orderNumber}")
    Orders getByNumber(String outTradeNo);

    @Select("select * from orders")
    List<Orders> getAllOrders();

    @Select("select * from orders where status = #{deliveryInProgress} and order_time < #{time}")
    List<Orders> getByStatusAndOrderTimeLT(Integer deliveryInProgress, LocalDateTime time);
}
